#include <iostream>
#include <fstream>
#include <string>
#include <list>
#include <stdlib.h>
#include <string.h>
#include <iomanip>
#include <clocale>
#include <uchar.h>
#include <climits>
#include <dlfcn.h>
#include <errno.h>
#include "IVrv_Install.h"

int ZipFolder(std::wstring strPath)
{
	std::wstring strPath7z = strPath + L".7z";
	strPath = L"jjbin";
	void *handle = dlopen("./lib/7zMgr.so", RTLD_LAZY);
	if (handle)
	{
		pfnCreateIVrvObj func = (pfnCreateIVrvObj)dlsym(handle, "CreateIVrvObj");
		if (func)
		{
			I7zMgrArchive *pObj = (I7zMgrArchive *)func(IID_I7zMgrArchive);
			if (pObj)
			{
                // 打开7z文件
				if (pObj->Open(strPath7z.c_str()))
				{
                    //解压所有文件到指定目录
					pObj->ExtractFile(-1,L"./jjbin2",NULL,0);
                    //压缩文件夹
					//pObj->ArchiveFiles(strPath.c_str());
				}
				pObj->Close();
			}
		}
	}
	else
	{
        fprintf (stderr, "%s\n", dlerror());
	}
	return 0;
}

int main(int argc, char *argv[])
{
	ZipFolder(L"jjbin");
	//RunPackge();
	std::cout << "this is a test\n";
	return 0;
}
